package com.xique.client.service.service.impl;

import com.xique.client.api.domain.ClientUserInfo;
import com.xique.client.bean.domain.ClientUserInform;
import com.xique.client.mapper.ClientUserInfoMapper;
import com.xique.client.service.service.IClientUserInfoService;
import com.xique.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 岗亭用户Service业务层处理
 * 
 * @author caogq
 * @date 2021-07-21
 */
@Service
public class ClientUserInfoServiceImpl implements IClientUserInfoService
{
    @Autowired
    private ClientUserInfoMapper clientUserInfoMapper;

    /**
     * 查询岗亭用户
     *
     * @param loginName 岗亭用户名称
     * @return 岗亭用户
     */
    @Override
    public ClientUserInfo selectClientUserByLoginName(String loginName) {
        return clientUserInfoMapper.selectClientUserByUsername(loginName);
    }

    /**
     * 查询岗亭用户列表
     *
     * @param clientUserInfo 岗亭用户
     * @return 岗亭用户
     */
    @Override
    public List<ClientUserInfo> selectClientUserList(ClientUserInfo clientUserInfo)
    {
        return clientUserInfoMapper.selectClientUserList(clientUserInfo);
    }

    /**
     * 查询岗亭用户
     * 
     * @param id 岗亭用户ID
     * @return 岗亭用户
     */
    @Override
    public ClientUserInform selectClientUserById(Long id)
    {
        return clientUserInfoMapper.selectById(id);
    }

    /**
     * 新增岗亭用户
     *
     * @param clientUserInform 岗亭用户
     * @return 结果
     */
    @Override
    public int insertClientUser(ClientUserInform clientUserInform)
    {
        clientUserInform.setCreateTime(DateUtils.getNowDate());
        return clientUserInfoMapper.insert(clientUserInform);
    }

    /**
     * 修改岗亭用户
     *
     * @param clientUserInform 岗亭用户
     * @return 结果
     */
    @Override
    public int updateClientUser(ClientUserInform clientUserInform)
    {
        clientUserInform.setUpdateTime(DateUtils.getNowDate());
        return clientUserInfoMapper.updateById(clientUserInform);
    }

    /**
     * 批量删除岗亭用户
     *
     * @param ids 需要删除的岗亭用户ID
     * @return 结果
     */
    @Override
    public int deleteClientUserByIds(Long[] ids)
    {
        return clientUserInfoMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除岗亭用户信息
     *
     * @param id 岗亭用户ID
     * @return 结果
     */
    @Override
    public int deleteClientUserById(Long id)
    {
        return clientUserInfoMapper.deleteById(id);
    }
}
